//
//  QDMPAdCycleTableViewCell.m
//  QDMetroClient
//
//  Created by YueWen on 2019/2/11.
//  Copyright © 2019 YueWen. All rights reserved.
//

#import "QDMPAdCycleTableViewCell.h"
#import "RITLCollectionViewPageFlowLayout.h"

CGFloat QDMainPageCycleAdTableViewCellHeight(void) {
    
    CGFloat scale = 60.0 / 335;
    CGFloat itemWidth = UIScreen.mainScreen.ritl_width - 20 - 20;
    return (NSInteger)ceil(itemWidth * scale) + 7 + 8;
}



@implementation QDMPAdCycleTableViewCell


- (void)buildView {
    [super buildView];
    
    self.contentView.backgroundColor = QDSMainPageBottomColor;
    self.cycleView.backgroundColor = QDSMainPageBottomColor;
    self.cycleView.contentView.backgroundColor = QDSMainPageBottomColor;
}


#pragma mark - <RITLSDCycleScrollViewDataSource>

- (UICollectionViewFlowLayout *)customFlowLayout:(RITLCollectionViewPageFlowLayout *)originFlowLayout {
    return [originFlowLayout ritl_mutable:^id _Nonnull(__kindof RITLCollectionViewPageFlowLayout *  _Nonnull flowLayout) {
       
        // 计算item的Size
        CGFloat scale = 60.0 / 335;
        CGFloat itemWidth = UIScreen.mainScreen.ritl_width - 20 - 20;
        flowLayout.itemSize = CGSizeMake(itemWidth, itemWidth * scale);
        flowLayout.sectionInset = UIEdgeInsetsMake(8, 20, 7, 20);
        return flowLayout;
        
    }];
}

@end
